<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
	pageEncoding="ISO-8859-1"%>
<%@ taglib prefix="sql" uri="http://java.sun.com/jsp/jstl/sql"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Advisor Schedule</title>
</head>
<body>

	<sql:setDataSource url="jdbc:derby://localhost:1527/sample" />
	
	<h1>Scheduled Meeting Times for the Week</h1>
	<table border='1'>
		<tr>
			<th>Advisor ID</th>
			<th>Banner ID</th>
			<th>Meeting Start Time</th>
			<th>Meeting End Time</th>
			<th>Day</th>
		</tr>

		<sql:query var="qryStudent">
                  SELECT app.ScheduledMeeting.smAdvisorId, app.ScheduledMeeting.smBannerId, app.ScheduledMeeting.smStartHour,
                  			app.ScheduledMeeting.smStartMin, app.ScheduledMeeting.smEndHour, app.ScheduledMeeting.smEndMin, app.ScheduledMeeting.smDay
                  FROM app.ScheduledMeeting
        </sql:query>



		<c:forEach var="row" items="${qryStudent.rows}">
			<tr>
				<td><c:out value="${row.smAdvisorId}" />
				</td>
				<td><c:out value="${row.smBannerId}" />
				</td>
				<td><c:out value="${row.smStartHour}" />&nbsp <c:out value="${row.smStartMin}" />
				</td>
				<td><c:out value="${row.smEndHour}" />&nbsp <c:out value="${row.smEndMin}" />
				</td>
				<td><c:out value="${row.smDay}" />
				</td>
			</tr>
		</c:forEach>


	</table> 
	
	<h1>My Schedule For the Week</h1>
	<table border='1'>
		<tr>
			<th>Advisor ID</th>
			<th>Last Name</th>
			<th>First Name</th>
			<th>Free Slot Start Time</th>
			<th>Free Slot End Time</th>
			<th>Day</th>			
		</tr>

		<sql:query var="qryStudent">
                  SELECT app.Advisor.Id, app.Advisor.aLastName, app.Advisor.aFirstName, app.AdvisorTime.atStartHour, app.AdvisorTime.atStartMin, app.AdvisorTime.atEndHour, 
                  		app.AdvisorTime.atEndMin, app.AdvisorTime.atDay
                  FROM app.Advisor, app.AdvisorTime
                  WHERE app.Advisor.Id = app.AdvisorTime.atAdvisorId
        </sql:query>



		<c:forEach var="row" items="${qryStudent.rows}">
			<tr>
				<td><c:out value="${row.Id}" />
				</td>
				<td><c:out value="${row.aLastName}" />
				</td>
				<td><c:out value="${row.aFirstName}" />
				</td>
				<td><c:out value="${row.atStartHour}" />&nbsp <c:out value="${row.atStartMin}" />
				</td>
				<td><c:out value="${row.atEndHour}" />&nbsp <c:out value="${row.atEndMin}" />
				</td>
				<td><c:out value="${row.atDay}" />
				</td>
			</tr>
		</c:forEach>


	</table>
</body>
</html>